<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue附加练习-简易计数器</title>
    <script src="../../js/vue.js"></script>
    <style>
        #app{
            width: 20%;
            margin: 3rem auto;
            display: flex;
            justify-content: space-around;
        }
        button{
            width: 20%;
        }
        span{
            color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <button v-on:click="add">+</button>
        <h2>当前数字: <span>{{count}}</span></h2>
        <button v-on:click="sub">-</button>
        
    </div>
    <script>
        var v_app = new Vue({
            el:"#app",
            data:{
                count:0
            },
            methods:{
                add:function(){
                    this.count++
                },
                sub:function(){
                    this.count--
                }
            }
        })
    </script>
</body>
</html>